<template>
  <div id="main-page">
    <div>
      <div class="top-panel">
        <el-table :data="tableData" border style="width: 100%">
          <el-table-column prop="patient_id" label="身份证"></el-table-column>
          <el-table-column prop="patient_name" label="患者姓名"></el-table-column>
          <!-- <el-table-column prop="nation" label="民族"></el-table-column> -->
          <!-- <el-table-column prop="sex" label="性别"></el-table-column> -->
          <el-table-column prop="dept_name" label="科室"></el-table-column>
          <!-- <el-table-column prop="institution_name" label="机构"></el-table-column> -->
          <!-- <el-table-column prop="address" label="地址"></el-table-column> -->
          <!-- <el-table-column prop="role" label="角色"></el-table-column> -->
          <!-- <el-table-column prop="email" label="邮箱"></el-table-column> -->
          <el-table-column prop="title" label="病历概述"></el-table-column>
          <el-table-column fixed="right" label="操作" width="220">
            <template slot-scope="scope">
              <!-- <el-button type="text" @click="lookMedicalReport(scope.row)">查看病历</el-button> -->
              <el-button type="text" @click="editMedicalReport(scope.row)">填写病历</el-button>
              <el-button type="text" @click="del(scope.row)">病历上链</el-button>
              <!-- <el-button type="text" @click="look(scope.row)">查看</el-button> -->
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="pagination-panel">
        <el-pagination  @current-change="changePage" background layout="prev, pager, next" :total="total"></el-pagination>
      </div>
    </div>
  </div>
</template>
<script>
import { recordList } from "@/utils/data/recordList";
import { medicalRecord } from "@/api";
export default {
  name: 'CurPatientInfo',
  data() {
    return {
      total: 0,
      keyWord1: null,
      tableData: null,
      types: null,
      data: {
        cur: 1,
      }
    }
  },
  created() {
    this.initData();
  },
  methods: {

    initData() {
      medicalRecord.getWaitHelpList(this.data).then(res => {
        console.log(res);
        this.tableData = res.data.data.records;
        this.total = res.data.data.total;
      })
    },
    changePage(value) {
      this.data.cur = value;
      this.initData();
    },

    // 查看病历信息
    lookMedicalReport(row) {
      console.log(row);
      this.$router.push({
        // name: 'PersonMedicalInfo',
        path: '/home/PersonMedicalInfo',
        query: {
          id: row.id,
          type: 'look'
        }
      })
    },

    // 填写病历
    editMedicalReport(row) {
      this.$router.push({
        path: '/home/PersonMedicalInfo',
        // name: 'PersonMedicalInfo',
        query: {
          id: row.id,
          type: 'edit'
        }
      })
    }
  }
}
</script>
